﻿<div class="breadcrumbs" id="breadcrumbs">
    <ul class="nav nav-tabs">
        <li class="active"><a href="/System/Role">角色列表</a></li>
    </ul>
</div>
<div>
    <label class="Add-R">
        <a id="AddNewRole" class="btn btn-xs btn-primary" data-toggle="modal" href="" onclick="showLayerOpen('添加角色','/system/Role/Edit/0','500px','360px')" title="添加新角色">
            <i class="icon-plus-sign bigger-130"></i>
            添加新角色
        </a>
    </label>
</div>
<table id="dataTable" class="table table-striped table-bordered table-hover">
    <thead>
        <tr>
            <th width="35">序号</th>
            <th>角色名称</th>
            <th>角色代码</th>
            <th>角色简介</th>
            <th>排序</th>
            <th>角色状态</th>
            <th width="120">
                操作
            </th>
        </tr>
    </thead>
</table>

@section scripts{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
    @Scripts.Render("~/bundles/permission")
    <script type="text/javascript">
        var isSearch = false;
        $(function () {
            var objTable = $("#dataTable").dataTable({
                fnDrawCallback: function () {
                    ControlPermissionOperate();
                },
                "sAjaxSource": "/System/Role",
                aoColumns: [
                             {
                                 "mData": null,
                                 "bSortable": false,
                                 "fnRender": function (nRow) {
                                     return nRow.iDataRow + 1;
                                 }
                             },
                            { "mData": "RoleName" },
                            { "mData": "RoleCode" },
                            { "mData": "Intro" },
                            { "mData": "OrderIndex" },
                            {
                                "mData": null,
                                fnRender: function (nRow) {
                                    return nRow.aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon;
                                }
                            },
                            {
                                "mData": null,
                                bSortable: false,
                                fnRender: function (nRow) {
                                    var html = "<a class=\"green Edit-R\" href=\"javascript:showLayerOpen('编辑角色','/System/Role/Edit/" + nRow.aData.ID + "','500px','360px')\" title=\"编辑\"><i class=\"icon-pencil bigger-130\"></i></a>";
                                    html += "<a href=\"/System/Role/RoleToPageAcionMapping?RoleID=" + nRow.aData.ID + "\" class=\"Edit-R\" title=\"角色权限编辑\"><i class=\"icon-user green bigger-120\"></i></a>";
                                    html += "<a class=\"red Disabled-R\" href=\"javascript:UpdateStatus('" + nRow.aData.ID + "'," + !nRow.aData.IsAvailable + ",'/System/Role/UpdateStatus','dataTable')\" title=\"" + (nRow.aData.IsAvailable ? "禁用" : "启用") + "\">" + (!nRow.aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon) + "</a>";
                                    html += "<a class=\"red Delete-R\" href=\"javascript:DeleteObj('" + nRow.aData.ID + "','/System/Role/DeleteRole','dataTable')\" title=\"彻底删除\"><i class=\"icon-trash bigger-130\"></i></a>";
                                    return html;
                                }
                            }
                ]
            });
        });
    </script>
}
